Recommendation Systems

author: Son Nguyen date: September 9, 2019 font-family: Garamond

Examples - Amazon

Examples - In e-commerce

Examples - In Social Media

Examples - Mobile Apps

Definition - Problem domain

Definition - Problem domain

Two types of systems

Two types of systems

Content- Based Filtering

Content- Based Filtering

Collaborative Filtering

Collaborative Filtering

Collaborative Filtering: Two approaches

Utility Matrix

```{r echo = FALSE} d = data.frame(i1 = c(5,3,4,3,1), i2 = c(3,1,3,3,5), i3 = c(4,2,4,1,5), i4 = c(4,3,3,4,2), i5 = c(‘???’, 3,5,4,1)) row.names(d)= c(‘Alice’, ‘User 1’,‘User 2’,‘User 3’,‘User 4’) names(d) = c(“Item 1”,“Item 2”,“Item 3”,“Item 4”,“Item 5”)

knitr::kable(d)

</center>

- A **recommendation problem** tunrs into a **prediction problem**.

- Predict the rating of the new user on his/her new item.

- If the predicted rating of *Alice* on Item 5 are high (4 or 5), we will recommend Item 5 to her. 


Nearest-neighbors (kNN)
---

- A "pure" CF approach and traditional baseline
- Using the utility as inputs
- Returns a ranked list of items based on rating predictions


Nearest-neighbors (kNN)
---

- **Assumptions**
  - If users had similar tastes in the past they will have similar tastes in the
future
  - User preferences remain stable and consistent over time


User-based KNN
---

<center>
```{r, echo = FALSE}
knitr::kable(d)

User-based KNN

{r, echo = FALSE} knitr::kable(d)

Let \(A1\) is the distance from Alice to User 1 and so on. We have:

\[ A1 = 3.60 \\ A2 = 1.41 \\ A3 = 3.60 \\ A4 = 5 \]

Item-based KNN

{r, echo = FALSE} knitr::kable(d)

Item-based KNN

{r, echo = FALSE} knitr::kable(d)

Let \(d54\) be the distance of item 5 to item 4 and so on. We have

\[ d54 = 2.23\\ d53 = 5.19 \\ d52 = 5 \\ d51 = 1.41 \]

Similarity Measure

Similarity Measure

Manhattan Distance

{r, echo = FALSE} knitr::kable(d[c(1,2),c(1:4)])

\[A1 = |5-3| + |3-1|+|4-2|+|4-3| = 7\]

Manhattan vs. Euclidean

Cosine Similarity

  • Cosine similarity is established as the standard in Recommendation System.

Cosine Similarity Measure

{r, echo = FALSE} knitr::kable(d[c(1,2),c(1:4)])

\[S1 = \frac{5 \cdot 3 + 3 \cdot 1 + 4 \cdot 2 + 4 \cdot 3}{\sqrt{5^2+3^2+4^2+4^2}\cdot \sqrt{3^2+1^2+2^2+3^2}} = 0.975\]

The Netflix Challenge

Link